#用python中的in关键字

# class Solution:
#     def commonChars(self, A) :
#         str = A[0]
#
#         T = []
#         for char in str:
#             index = []
#             j = 0
#             for i in range(1,len(A)):
#                 if char not in A[i]:
#                     j = 1
#                     break
#                 else:
#                     index.append(A[i].index(char))
#
#             if (j != 1):
#                 k = 1
#                 for ind in (index):
#                     A[k] = A[k].replace(A[k][ind],"",1)
#                     k = k+1
#                 T.append(char)
#
#         return T

from collections import Counter
from functools import reduce
class Solution:
    def commonChars(self, A) :
        # return map(Counter,A)
        return list(map(Counter,A))

if __name__ == '__main__':
    S = Solution()
    T = S.commonChars(["cool","lock","cook"])
    print(T[0]&T[1])

    print(T)


